3.2.44 \(\int x^2 \tan ^2(a+i \log (x)) \, dx\) [144]

3.2.44.1 Optimal result
3.2.44.2 Mathematica [A] (verified)
3.2.44.3 Rubi [A] (verified)
3.2.44.4 Maple [A] (verified)
3.2.44.5 Fricas [A] (verification not implemented)
3.2.44.6 Sympy [A] (verification not implemented)
3.2.44.7 Maxima [B] (verification not implemented)
3.2.44.8 Giac [B] (verification not implemented)
3.2.44.9 Mupad [B] (verification not implemented)

3.2.44.1 Optimal result

Integrand size = 15, antiderivative size = 62 \[ \int x^2 \tan ^2(a+i \log (x)) \, dx=6 e^{2 i a} x-\frac {x^3}{3}-\frac {2 e^{2 i a} x^3}{e^{2 i a}+x^2}-6 e^{3 i a} \arctan \left (e^{-i a} x\right ) \]

output
6*exp(2*I*a)*x-1/3*x^3-2*exp(2*I*a)*x^3/(exp(2*I*a)+x^2)-6*exp(3*I*a)*arct 
an(x/exp(I*a))
 
3.2.44.2 Mathematica [A] (verified)

Time = 0.10 (sec) , antiderivative size = 100, normalized size of antiderivative = 1.61 \[ \int x^2 \tan ^2(a+i \log (x)) \, dx=-\frac {x^3}{3}+4 x \cos (2 a)-6 \arctan (x (\cos (a)-i \sin (a))) \cos (3 a)+4 i x \sin (2 a)+\frac {2 x (\cos (3 a)+i \sin (3 a))}{\left (1+x^2\right ) \cos (a)-i \left (-1+x^2\right ) \sin (a)}-6 i \arctan (x (\cos (a)-i \sin (a))) \sin (3 a) \]

input
Integrate[x^2*Tan[a + I*Log[x]]^2,x]
 
output
-1/3*x^3 + 4*x*Cos[2*a] - 6*ArcTan[x*(Cos[a] - I*Sin[a])]*Cos[3*a] + (4*I) 
*x*Sin[2*a] + (2*x*(Cos[3*a] + I*Sin[3*a]))/((1 + x^2)*Cos[a] - I*(-1 + x^ 
2)*Sin[a]) - (6*I)*ArcTan[x*(Cos[a] - I*Sin[a])]*Sin[3*a]
 
3.2.44.3 Rubi [A] (verified)

Time = 0.25 (sec) , antiderivative size = 79, normalized size of antiderivative = 1.27, number of steps used = 7, number of rules used = 7, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.467, Rules used = {5006, 947, 366, 27, 363, 262, 216}

Below are the steps used by Rubi to obtain the solution. The rule number used for the transformation is given above next to the arrow. The rules definitions used are listed below.

\(\displaystyle \int x^2 \tan ^2(a+i \log (x)) \, dx\)

\(\Big \downarrow \) 5006

\(\displaystyle \int \frac {x^2 \left (i-\frac {i e^{2 i a}}{x^2}\right )^2}{\left (1+\frac {e^{2 i a}}{x^2}\right )^2}dx\)

\(\Big \downarrow \) 947

\(\displaystyle \int \frac {x^2 \left (i x^2-i e^{2 i a}\right )^2}{\left (x^2+e^{2 i a}\right )^2}dx\)

\(\Big \downarrow \) 366

\(\displaystyle -\frac {1}{2} e^{-2 i a} \int -\frac {2 x^2 \left (5 e^{4 i a}-e^{2 i a} x^2\right )}{x^2+e^{2 i a}}dx-\frac {2 e^{2 i a} x^3}{x^2+e^{2 i a}}\)

\(\Big \downarrow \) 27

\(\displaystyle e^{-2 i a} \int \frac {x^2 \left (5 e^{4 i a}-e^{2 i a} x^2\right )}{x^2+e^{2 i a}}dx-\frac {2 e^{2 i a} x^3}{x^2+e^{2 i a}}\)

\(\Big \downarrow \) 363

\(\displaystyle e^{-2 i a} \left (6 e^{4 i a} \int \frac {x^2}{x^2+e^{2 i a}}dx-\frac {1}{3} e^{2 i a} x^3\right )-\frac {2 e^{2 i a} x^3}{x^2+e^{2 i a}}\)

\(\Big \downarrow \) 262

\(\displaystyle e^{-2 i a} \left (6 e^{4 i a} \left (x-e^{2 i a} \int \frac {1}{x^2+e^{2 i a}}dx\right )-\frac {1}{3} e^{2 i a} x^3\right )-\frac {2 e^{2 i a} x^3}{x^2+e^{2 i a}}\)

\(\Big \downarrow \) 216

\(\displaystyle e^{-2 i a} \left (6 e^{4 i a} \left (x-e^{i a} \arctan \left (e^{-i a} x\right )\right )-\frac {1}{3} e^{2 i a} x^3\right )-\frac {2 e^{2 i a} x^3}{x^2+e^{2 i a}}\)

input
Int[x^2*Tan[a + I*Log[x]]^2,x]
 
output
(-2*E^((2*I)*a)*x^3)/(E^((2*I)*a) + x^2) + (-1/3*(E^((2*I)*a)*x^3) + 6*E^( 
(4*I)*a)*(x - E^(I*a)*ArcTan[x/E^(I*a)]))/E^((2*I)*a)
 

3.2.44.3.1 Defintions of rubi rules used

rule 27
Int[(a_)*(Fx_), x_Symbol] :> Simp[a   Int[Fx, x], x] /; FreeQ[a, x] &&  !Ma 
tchQ[Fx, (b_)*(Gx_) /; FreeQ[b, x]]
 

rule 216
Int[((a_) + (b_.)*(x_)^2)^(-1), x_Symbol] :> Simp[(1/(Rt[a, 2]*Rt[b, 2]))*A 
rcTan[Rt[b, 2]*(x/Rt[a, 2])], x] /; FreeQ[{a, b}, x] && PosQ[a/b] && (GtQ[a 
, 0] || GtQ[b, 0])
 

rule 262
Int[((c_.)*(x_))^(m_)*((a_) + (b_.)*(x_)^2)^(p_), x_Symbol] :> Simp[c*(c*x) 
^(m - 1)*((a + b*x^2)^(p + 1)/(b*(m + 2*p + 1))), x] - Simp[a*c^2*((m - 1)/ 
(b*(m + 2*p + 1)))   Int[(c*x)^(m - 2)*(a + b*x^2)^p, x], x] /; FreeQ[{a, b 
, c, p}, x] && GtQ[m, 2 - 1] && NeQ[m + 2*p + 1, 0] && IntBinomialQ[a, b, c 
, 2, m, p, x]
 

rule 363
Int[((e_.)*(x_))^(m_.)*((a_) + (b_.)*(x_)^2)^(p_.)*((c_) + (d_.)*(x_)^2), x 
_Symbol] :> Simp[d*(e*x)^(m + 1)*((a + b*x^2)^(p + 1)/(b*e*(m + 2*p + 3))), 
 x] - Simp[(a*d*(m + 1) - b*c*(m + 2*p + 3))/(b*(m + 2*p + 3))   Int[(e*x)^ 
m*(a + b*x^2)^p, x], x] /; FreeQ[{a, b, c, d, e, m, p}, x] && NeQ[b*c - a*d 
, 0] && NeQ[m + 2*p + 3, 0]
 

rule 366
Int[((e_.)*(x_))^(m_.)*((a_) + (b_.)*(x_)^2)^(p_)*((c_) + (d_.)*(x_)^2)^2, 
x_Symbol] :> Simp[(-(b*c - a*d)^2)*(e*x)^(m + 1)*((a + b*x^2)^(p + 1)/(2*a* 
b^2*e*(p + 1))), x] + Simp[1/(2*a*b^2*(p + 1))   Int[(e*x)^m*(a + b*x^2)^(p 
 + 1)*Simp[(b*c - a*d)^2*(m + 1) + 2*b^2*c^2*(p + 1) + 2*a*b*d^2*(p + 1)*x^ 
2, x], x], x] /; FreeQ[{a, b, c, d, e, m}, x] && NeQ[b*c - a*d, 0] && LtQ[p 
, -1]
 

rule 947
Int[(x_)^(m_.)*((a_) + (b_.)*(x_)^(n_))^(p_.)*((c_) + (d_.)*(x_)^(n_))^(q_. 
), x_Symbol] :> Int[x^(m + n*(p + q))*(b + a/x^n)^p*(d + c/x^n)^q, x] /; Fr 
eeQ[{a, b, c, d, m, n}, x] && NeQ[b*c - a*d, 0] && IntegersQ[p, q] && NegQ[ 
n]
 

rule 5006
Int[((e_.)*(x_))^(m_.)*Tan[((a_.) + Log[x_]*(b_.))*(d_.)]^(p_.), x_Symbol] 
:> Int[(e*x)^m*((I - I*E^(2*I*a*d)*x^(2*I*b*d))/(1 + E^(2*I*a*d)*x^(2*I*b*d 
)))^p, x] /; FreeQ[{a, b, d, e, m, p}, x]
 
3.2.44.4 Maple [A] (verified)

Time = 2.92 (sec) , antiderivative size = 48, normalized size of antiderivative = 0.77

method result size
risch \(-\frac {7 x^{3}}{3}+\frac {2 x^{3}}{1+\frac {{\mathrm e}^{2 i a}}{x^{2}}}+6 \,{\mathrm e}^{2 i a} x -6 \arctan \left (x \,{\mathrm e}^{-i a}\right ) {\mathrm e}^{3 i a}\) \(48\)

input
int(x^2*tan(a+I*ln(x))^2,x,method=_RETURNVERBOSE)
 
output
-7/3*x^3+2*x^3/(1+exp(2*I*a)/x^2)+6*exp(2*I*a)*x-6*arctan(x*exp(-I*a))*exp 
(3*I*a)
 
3.2.44.5 Fricas [A] (verification not implemented)

Time = 0.24 (sec) , antiderivative size = 86, normalized size of antiderivative = 1.39 \[ \int x^2 \tan ^2(a+i \log (x)) \, dx=-\frac {x^{5} - 11 \, x^{3} e^{\left (2 i \, a\right )} - 18 \, x e^{\left (4 i \, a\right )} + 9 \, {\left (i \, x^{2} e^{\left (3 i \, a\right )} + i \, e^{\left (5 i \, a\right )}\right )} \log \left (x + i \, e^{\left (i \, a\right )}\right ) + 9 \, {\left (-i \, x^{2} e^{\left (3 i \, a\right )} - i \, e^{\left (5 i \, a\right )}\right )} \log \left (x - i \, e^{\left (i \, a\right )}\right )}{3 \, {\left (x^{2} + e^{\left (2 i \, a\right )}\right )}} \]

input
integrate(x^2*tan(a+I*log(x))^2,x, algorithm="fricas")
 
output
-1/3*(x^5 - 11*x^3*e^(2*I*a) - 18*x*e^(4*I*a) + 9*(I*x^2*e^(3*I*a) + I*e^( 
5*I*a))*log(x + I*e^(I*a)) + 9*(-I*x^2*e^(3*I*a) - I*e^(5*I*a))*log(x - I* 
e^(I*a)))/(x^2 + e^(2*I*a))
 
3.2.44.6 Sympy [A] (verification not implemented)

Time = 0.17 (sec) , antiderivative size = 66, normalized size of antiderivative = 1.06 \[ \int x^2 \tan ^2(a+i \log (x)) \, dx=- \frac {x^{3}}{3} + 4 x e^{2 i a} + \frac {2 x e^{4 i a}}{x^{2} + e^{2 i a}} - 3 \left (- i \log {\left (x - i e^{i a} \right )} + i \log {\left (x + i e^{i a} \right )}\right ) e^{3 i a} \]

input
integrate(x**2*tan(a+I*ln(x))**2,x)
 
output
-x**3/3 + 4*x*exp(2*I*a) + 2*x*exp(4*I*a)/(x**2 + exp(2*I*a)) - 3*(-I*log( 
x - I*exp(I*a)) + I*log(x + I*exp(I*a)))*exp(3*I*a)
 
3.2.44.7 Maxima [B] (verification not implemented)

Both result and optimal contain complex but leaf count of result is larger than twice the leaf count of optimal. 254 vs. \(2 (45) = 90\).

Time = 0.31 (sec) , antiderivative size = 254, normalized size of antiderivative = 4.10 \[ \int x^2 \tan ^2(a+i \log (x)) \, dx=-\frac {2 \, x^{5} - 22 \, x^{3} {\left (\cos \left (2 \, a\right ) + i \, \sin \left (2 \, a\right )\right )} - 36 \, x {\left (\cos \left (4 \, a\right ) + i \, \sin \left (4 \, a\right )\right )} - 18 \, {\left (x^{2} {\left (\cos \left (3 \, a\right ) + i \, \sin \left (3 \, a\right )\right )} + {\left (\cos \left (2 \, a\right ) + i \, \sin \left (2 \, a\right )\right )} \cos \left (3 \, a\right ) - {\left (-i \, \cos \left (2 \, a\right ) + \sin \left (2 \, a\right )\right )} \sin \left (3 \, a\right )\right )} \arctan \left (\frac {2 \, x \cos \left (a\right )}{x^{2} + \cos \left (a\right )^{2} - 2 \, x \sin \left (a\right ) + \sin \left (a\right )^{2}}, \frac {x^{2} - \cos \left (a\right )^{2} - \sin \left (a\right )^{2}}{x^{2} + \cos \left (a\right )^{2} - 2 \, x \sin \left (a\right ) + \sin \left (a\right )^{2}}\right ) + 9 \, {\left (x^{2} {\left (-i \, \cos \left (3 \, a\right ) + \sin \left (3 \, a\right )\right )} + {\left (-i \, \cos \left (2 \, a\right ) + \sin \left (2 \, a\right )\right )} \cos \left (3 \, a\right ) + {\left (\cos \left (2 \, a\right ) + i \, \sin \left (2 \, a\right )\right )} \sin \left (3 \, a\right )\right )} \log \left (\frac {x^{2} + \cos \left (a\right )^{2} + 2 \, x \sin \left (a\right ) + \sin \left (a\right )^{2}}{x^{2} + \cos \left (a\right )^{2} - 2 \, x \sin \left (a\right ) + \sin \left (a\right )^{2}}\right )}{6 \, {\left (x^{2} + \cos \left (2 \, a\right ) + i \, \sin \left (2 \, a\right )\right )}} \]

input
integrate(x^2*tan(a+I*log(x))^2,x, algorithm="maxima")
 
output
-1/6*(2*x^5 - 22*x^3*(cos(2*a) + I*sin(2*a)) - 36*x*(cos(4*a) + I*sin(4*a) 
) - 18*(x^2*(cos(3*a) + I*sin(3*a)) + (cos(2*a) + I*sin(2*a))*cos(3*a) - ( 
-I*cos(2*a) + sin(2*a))*sin(3*a))*arctan2(2*x*cos(a)/(x^2 + cos(a)^2 - 2*x 
*sin(a) + sin(a)^2), (x^2 - cos(a)^2 - sin(a)^2)/(x^2 + cos(a)^2 - 2*x*sin 
(a) + sin(a)^2)) + 9*(x^2*(-I*cos(3*a) + sin(3*a)) + (-I*cos(2*a) + sin(2* 
a))*cos(3*a) + (cos(2*a) + I*sin(2*a))*sin(3*a))*log((x^2 + cos(a)^2 + 2*x 
*sin(a) + sin(a)^2)/(x^2 + cos(a)^2 - 2*x*sin(a) + sin(a)^2)))/(x^2 + cos( 
2*a) + I*sin(2*a))
 
3.2.44.8 Giac [B] (verification not implemented)

Both result and optimal contain complex but leaf count of result is larger than twice the leaf count of optimal. 141 vs. \(2 (45) = 90\).

Time = 0.46 (sec) , antiderivative size = 141, normalized size of antiderivative = 2.27 \[ \int x^2 \tan ^2(a+i \log (x)) \, dx=-\frac {x^{5}}{3 \, {\left (x^{2} + \frac {e^{\left (4 i \, a\right )}}{x^{2}} + 2 \, e^{\left (2 i \, a\right )}\right )}} + \frac {10 \, x^{3} e^{\left (2 i \, a\right )}}{3 \, {\left (x^{2} + \frac {e^{\left (4 i \, a\right )}}{x^{2}} + 2 \, e^{\left (2 i \, a\right )}\right )}} - 6 \, \arctan \left (x e^{\left (-i \, a\right )}\right ) e^{\left (3 i \, a\right )} + \frac {35 \, x e^{\left (4 i \, a\right )}}{3 \, {\left (x^{2} + \frac {e^{\left (4 i \, a\right )}}{x^{2}} + 2 \, e^{\left (2 i \, a\right )}\right )}} + \frac {2 \, x e^{\left (4 i \, a\right )}}{x^{2} + e^{\left (2 i \, a\right )}} + \frac {8 \, e^{\left (6 i \, a\right )}}{{\left (x^{2} + \frac {e^{\left (4 i \, a\right )}}{x^{2}} + 2 \, e^{\left (2 i \, a\right )}\right )} x} \]

input
integrate(x^2*tan(a+I*log(x))^2,x, algorithm="giac")
 
output
-1/3*x^5/(x^2 + e^(4*I*a)/x^2 + 2*e^(2*I*a)) + 10/3*x^3*e^(2*I*a)/(x^2 + e 
^(4*I*a)/x^2 + 2*e^(2*I*a)) - 6*arctan(x*e^(-I*a))*e^(3*I*a) + 35/3*x*e^(4 
*I*a)/(x^2 + e^(4*I*a)/x^2 + 2*e^(2*I*a)) + 2*x*e^(4*I*a)/(x^2 + e^(2*I*a) 
) + 8*e^(6*I*a)/((x^2 + e^(4*I*a)/x^2 + 2*e^(2*I*a))*x)
 
3.2.44.9 Mupad [B] (verification not implemented)

Time = 27.68 (sec) , antiderivative size = 52, normalized size of antiderivative = 0.84 \[ \int x^2 \tan ^2(a+i \log (x)) \, dx=-6\,{\left ({\mathrm {e}}^{a\,2{}\mathrm {i}}\right )}^{3/2}\,\mathrm {atan}\left (\frac {x}{\sqrt {{\mathrm {e}}^{a\,2{}\mathrm {i}}}}\right )-\frac {x^3}{3}+4\,x\,{\mathrm {e}}^{a\,2{}\mathrm {i}}+\frac {2\,x\,{\mathrm {e}}^{a\,4{}\mathrm {i}}}{x^2+{\mathrm {e}}^{a\,2{}\mathrm {i}}} \]

input
int(x^2*tan(a + log(x)*1i)^2,x)
 
output
4*x*exp(a*2i) - x^3/3 - 6*exp(a*2i)^(3/2)*atan(x/exp(a*2i)^(1/2)) + (2*x*e 
xp(a*4i))/(exp(a*2i) + x^2)